#ifndef _WINSOCK2SOCKETFACTORY_H
#define _WINSOCK2SOCKETFACTORY_H

#pragma once
#include "SocketFactory.h"
#include "Winsock2ClientSocket.h"
#include "Winsock2ServerSocket.h"
#include <list>

using namespace std;

namespace net
{
/*
 * This is the Winsock2 implementation of the sockets factory.
 * Specific Winsock2 client and server sockets are created through this factory.
 * To create a Winsock2 socket, do the following:
 * - obtain an instance of the factory:
 *
 *   Winsock2SocketFactory* sf = net::Winsock2SocketFactory::getInstance();
 *
 * - then create instances of sockets:
 *
 *   net::Socket* cs = sf->createClientSocket();
 *   net::Socket* ss = sf->createServerSocket();
 */
class Winsock2SocketFactory : public SocketFactory
{
public:
	Winsock2SocketFactory(void);
	virtual ~Winsock2SocketFactory(void);
	virtual Socket* createSocket(void);
	virtual ClientSocket* createClientSocket(string, string);
	virtual ServerSocket* createServerSocket(int);
	virtual void release(void);
	static Winsock2SocketFactory* getInstance(void);
private:
	list<Socket*> sockets;
	static bool _initialised;
	static Winsock2SocketFactory _instance;
};
};

#endif
